#include<stdio.h>
#include<string.h>
#define MAXN 1000+1

int main()
{
    FILE *IN, *OUT;
    if((IN = fopen("encrypt.txt","r")) == NULL)
    {
        printf("The file do not exist.\n");
        return -1;
    }
    OUT = fopen("output.txt","w");
    char key[255], line[MAXN];
    scanf("%s", key);
    int used[150], top = 0;
    memset(used, 0, sizeof(used));
    for(int i=0;key[i];i++)
    {
        if(!used[(int)key[i]])
        {
            key[top++] = key[i];
            used[(int)key[i]] = 1;            
        }
    }
    for(int i=122;i>=97;i--)
    {
        if(!used[i])
            key[top++] = (char)i;
    }
    fgets(line, MAXN-1, IN);
    for(int i=0;line[i];i++)
    {
        if(line[i]>='a' && line[i]<='z')
            line[i] = key[line[i]-97];
    }
    fputs(line, OUT);
    fclose(IN);
    fclose(OUT);
    return 0;
}
